let msgStorage = require("msgstorage");
let msgType = require("msgtype");

Component({
	properties: {
		username: {
			type: Object,
			value: {},
		},
    chufang:{
      type:Object,
      value:{}
    },
		chatType: {
			type: String,
			value: msgType.chatType.SINGLE_CHAT,
		},
    list:{
      type:String,
      value:{}
    },
    orders:{
      type:String,
      value:''
    },
    useropenid:{
      type:String,
      value:''
    },
    z_name:{
      type:String,
      value:''
    }
	},
  // pageLifetimes: {
  //   show: function () {
  //     // 页面被展示
  //     console.log(this.properties.z_name)
  //     console.log(this.properties.list)
  //     console.log(this.properties.useropenid)
  //     console.log(this.properties.username)
  //     console.log(this.properties.orders)
  //   },
  // },
	data: {
		__comps__: {
			msglist: null,
			inputbar: null,
			audio: null,
		},
    show: !0,
    hide: !1,
	},
	methods: {
		toggleRecordModal(){
			this.data.__comps__.audio.toggleRecordModal();
		},

		normalScroll(){
			this.data.__comps__.msglist.normalScroll();
			// this.data.__comps__.inputbar.cancelEmoji();
		},

		shortScroll(){
			this.data.__comps__.msglist.shortScroll();
		},

		saveSendMsg(evt){
			msgStorage.saveMsg(evt.detail.msg, evt.detail.type);
			// this.data.__comps__.inputbar.cancelEmoji();
		},
    clickshow: function (t) {
      this.setData({
        show: !0,
        hide: !1
      });
    },
    clickshow1: function (t) {
      this.setData({
        show: !1,
        hide: !0
      });
    },
		getMore(){
			this.selectComponent('#chat-msglist').getHistoryMsg()
		},
  	},

	// lifetimes
	created(){},
	attached(){},
	ready(){
		this.data.__comps__.inputbar = this.selectComponent("#chat-inputbar");
    this.data.__comps__.msglist = this.selectComponent("#chat-msglist");
		this.data.__comps__.audio = this.selectComponent("#chat-suit-audio");
    this.data.__comps__.msglistback = this.selectComponent("#chat-msglistback");
	},
	moved(){},
	detached(){
	},

});
